import { defineConfig } from '@vben/vite-config';

const config: any = defineConfig(async () => {
  return {
    application: {},
    vite: {
      plugins: [
      ],
      server: {
        proxy: {
          '/api': {
            changeOrigin: true,
            // rewrite: (path) => path.replace(/^\/api/, ''),
            target:'http://devadmin.shensizaowu.com',
            // target: 'http://192.168.1.252:8080',//佳甫新环境
            // target: 'http://192.168.1.252:8080',//志军新环境
            // target: 'https://sitadmin.shensizaowu.com/',//sitAdmin新环境
            // target: 'https://sit-cert.shensizaowu.com/',//sit用户新环境
            ws: true,
          },
          // 华为云VOD API代理
          '/vod-api': {
            changeOrigin: true,
            rewrite: (path) => path.replace(/^\/vod-api/, ''),
            target: 'https://vod.cn-north-4.myhuaweicloud.com',
            ws: true,
            headers: {
              'Origin': 'https://vod.cn-north-4.myhuaweicloud.com'
            }
          },
          // IAM API代理
          '/iam-api': {
            changeOrigin: true,
            rewrite: (path) => path.replace(/^\/iam-api/, ''),
            target: 'https://iam.cn-north-4.myhuaweicloud.com',
            ws: true,
            headers: {
              'Origin': 'https://iam.cn-north-4.myhuaweicloud.com'
            }
          },
        },
      },
    },
  };
});

export default config;
